#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include "studentform.h"
#include "teacherform.h"
#include "regform.h"
#include <QMainWindow>
#include <QtSql>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    bool createConnection(const QString&, const QString&, const QString&, const QString&);

protected:
    void keyPressEvent(QKeyEvent *key);
    bool check(const QString &login, const QString &password, const QString &tableName);
    bool isTeacher(const QString &login, const QString &password);
    bool isStudent(const QString &login, const QString &password);

private:
    Ui::MainWindow *ui;
     studentForm *sf;
     teacherForm *tf;
     regForm *rf;
     QSqlDatabase db;

public slots:
    void enter();
};

#endif // MAINWINDOW_H
